//
//  DSZShopaCell.m
//  7.13苏宁框架
//
//  Created by app20 on 15/7/28.
//  Copyright (c) 2015年 lovena. All rights reserved.
//

#import "DSZShopsCell.h"
#import "Common.h"

@interface DSZShopsCell ()

@property(nonatomic,weak) UIImageView *image;
@property(nonatomic,weak) UILabel *titleLabel;
@property(nonatomic,weak) UILabel *describeLabel;
@property(nonatomic,weak) UILabel *priceLabel;
@property(nonatomic,weak) UILabel *commentLabel;

@end

@implementation DSZShopsCell


//+ (NSString *)xib
//{
//    return @"DSZShopaCell";
//}
//
//- (void)awakeFromNib {
//    
//    self.backgroundColor = [UIColor redColor];
//}
//
//- (void)setSelected:(BOOL)selected animated:(BOOL)animated {
//    [super setSelected:selected animated:animated];
//
//    // Configure the view for the selected state
//}


-(id)initWithStyle:(UITableViewCellStyle)style reuseIdentifier:(NSString *)reuseIdentifier
{
    self =  [super  initWithStyle:style reuseIdentifier:reuseIdentifier];
    if (self) {
        [self initSubviews];
    }
    return   self;
}

- (void)initSubviews
{
    UIImageView *icon = [[UIImageView alloc] initWithFrame:CGRectMake(15, 10, 80, 80)];
//    icon.image = [UIImage  imageNamed:_icon];
    _image = icon;
    [self addSubview:icon];
    
    UILabel *title = [[UILabel alloc] initWithFrame:CGRectMake(icon.right + 10, 10, self.width - icon.right - 20, 30)];
//    title.text = _title;
    title.font = [UIFont systemFontOfSize:12];
    title.numberOfLines = 0;
    _titleLabel = title;
    [self addSubview:title];
    
    UILabel *describe = [[UILabel alloc] initWithFrame:CGRectMake(icon.right + 10, title.bottom + 5, self.width - icon.right - 20, 10)];
//    describe.text = _describe;
    describe.font = [UIFont systemFontOfSize:11];
    describe.textColor = [UIColor lightGrayColor];
    _describeLabel = describe;
    [self addSubview:describe];
    
    UILabel *priceIcon = [[UILabel alloc] initWithFrame:CGRectMake(icon.right + 10, describe.bottom + 5, 10, 15)];
    priceIcon.text = @"¥";
    priceIcon.textColor = [UIColor redColor];
    [self addSubview:priceIcon];
    
    UILabel *price = [[UILabel alloc] initWithFrame:CGRectMake(priceIcon.right, describe.bottom + 5, 100, 15)];
//    price.text = _price;
    price.textColor = [UIColor redColor];
    _priceLabel = price;
    [self addSubview:price];
    
    UILabel *comment = [[UILabel alloc] initWithFrame:CGRectMake(icon.right + 10, price.bottom + 5, 30, 10)];
    comment.text = @"评论";
    comment.font = [UIFont systemFontOfSize:11];
    comment.textColor = [UIColor lightGrayColor];
    [self addSubview:comment];
    
    UILabel *commentNum = [[UILabel alloc] initWithFrame:CGRectMake(comment.right, price.bottom + 5, 30, 10)];
//    commentNum.text = _commentNum;
    commentNum.font = [UIFont systemFontOfSize:11];
    commentNum.textColor = [UIColor lightGrayColor];
    _commentLabel = commentNum;
    [self addSubview:commentNum];

}

- (void)setIcon:(NSString *)icon{
    
    if (_icon != icon) {
        
        _icon = icon;
    }
    
    [_image  setImageWithURL:[NSURL URLWithString:icon]];

}

- (void)setTitle:(NSString *)title{
    
    if (_title != title) {
        
        _title = title;
    }
    
    _titleLabel.text = title;

}

- (void)setDescribe:(NSString *)describe{
    
    if (_describe != describe) {
        
        _describe = describe;
    }
    
    _describeLabel.text = describe;

}

- (void)setPrice:(NSString *)price{
    
    if (_price != price) {
        
        _price = price;
    }
    
    _priceLabel.text = price;

}

- (void)setCommentNum:(NSString *)commentNum{
    
    if (_commentNum != commentNum) {
        
        _commentNum = commentNum;
    }
    
    _commentLabel.text = commentNum;

}


@end
